Skip to content

Code generator scripts refactor; Add credential, role, and schedule construct schemas with Go models#629

Merged
fitzergerald merged 42 commits intomasterfrom
add-credential-role-schedule-models
Mar 18, 2026
Merged

Code generator scripts refactor; Add credential, role, and schedule construct schemas with Go models#629
fitzergerald merged 42 commits intomasterfrom
add-credential-role-schedule-models

Conversation

@leecalcote
Copy link
Copy Markdown
Member

@leecalcote leecalcote commented Mar 17, 2026

Summary

This PR refactors the Go schema generation workflow to operate from source construct schemas, adds the new credential, role, and schedule constructs for v1beta1, and applies the compatibility fixes required to keep downstream Meshery consumers building against the generated types.

Why this PR exists

The repository is moving further toward schemas as the source of truth for shared object models.

This PR does three things that are tightly related:

  1. It makes Go generation work from source construct schemas instead of only from dereferenced bundled output.
  2. It introduces the new cloud-facing schema constructs that depend on that generator behavior.
  3. It incorporates review-driven compatibility fixes where the new generation path changed exported Go types in ways that affected existing consumers.

What changed

1. Refactored Go generation to use source schemas directly

Files:

  • build/generate-golang.js
  • build/openapi.config.yml
  • build/generate-typescript.js

Rationale:

  • generate Go types from source api.yml / subschema structure instead of relying only on fully bundled output
  • derive cross-package import mappings from reachable external $ref targets at generation time
  • preserve schema-declared x-oapi-codegen-extra-tags, x-go-name, and explicit x-go-type overrides more reliably
  • support explicit Go import aliases through x-go-type-import.name, avoiding unstable alias guessing in generated code
  • keep TypeScript schema constants buildable by emitting satisfies Record<string, unknown> instead of as const

Why this matters:

  • cross-package type reuse is now driven by the source schema graph
  • review feedback around missing db/gorm tags and unstable type names can be handled in the generator instead of with one-off generated-file edits
  • the generator now respects explicit schema intent where downstream packages depend on the exact emitted types

2. Added new v1beta1 constructs

Files:

  • schemas/constructs/v1beta1/credential/api.yml
  • schemas/constructs/v1beta1/role/api.yml
  • schemas/constructs/v1beta1/schedule/api.yml
  • related handwritten helpers already included in the branch for these constructs

Rationale:

  • add shared schema definitions for credential, role, and schedule resources used by Meshery Cloud
  • define their REST surfaces and reusable schema components in the same construct-driven layout used elsewhere in the repo
  • let those resources participate in the same schema-to-Go/TypeScript pipeline as the rest of the repository

3. Normalized schema references onto construct index files

Representative files:

  • schemas/constructs/v1beta1/component/component.yaml
  • schemas/constructs/v1beta1/connection/connection.yaml
  • schemas/constructs/v1beta1/model/model.yaml
  • schemas/constructs/v1beta1/evaluation/api.yml
  • schemas/constructs/v1beta1/design/api.yml
  • schemas/constructs/v1alpha3/relationship/relationship.yaml
  • schemas/constructs/v1beta1/academy/api.yml

Rationale:

  • move references toward api.yml#/components/... entrypoints instead of deprecated or fragile deep-path patterns
  • keep construct boundaries explicit so package discovery and cross-package imports remain predictable
  • replace unsupported deep property refs with named reusable schemas where necessary

Why this matters:

  • it aligns the source schemas with the index-file model used by the updated generator
  • it reduces ref breakage from dereferencing and code generation edge cases

4. Restored compatibility for generated Go types after the generator refactor

Representative files:

  • schemas/constructs/v1beta1/design/design.yaml
  • schemas/constructs/v1beta1/design/api.yml
  • schemas/constructs/v1beta1/evaluation/api.yml
  • schemas/constructs/v1beta1/component/component.yaml
  • schemas/constructs/v1beta1/model/model.yaml
  • schemas/constructs/v1beta1/feature/api.yml
  • schemas/constructs/v1beta1/subscription/api.yml
  • schemas/constructs/v1beta1/connection/connection.yaml
  • schemas/constructs/v1beta1/academy/api.yml
  • schemas/constructs/v1alpha3/relationship/relationship.yaml
  • models/v1beta1/component/component_helper.go
  • models/v1beta1/pattern/design_conversion.go
  • models/v1alpha3/relationship/relationship_helper.go

Rationale:

  • restore PatternFile.Components and PatternFile.Relationships as pointer slices where downstream Meshery code expects pointer semantics
  • make cross-package Go aliases explicit in schema metadata so generated code is deterministic across component, relationship, model, connection, feature, subscription, academy, and evaluation
  • add compatibility aliases in handwritten relationship helpers where generator-produced type names changed
  • update handwritten helpers/conversion logic to match the regenerated types instead of relying on stale assumptions

Why this matters:

  • these changes directly address review feedback that the new generator path could introduce breaking changes in Meshery
  • they keep schema intent and generated Go behavior aligned without hand-editing generated artifacts as the fix mechanism

5. Review-driven scope cleanup

Removed from this PR:

Rationale:

  • capability work was broader than the core generator plus construct changes in this PR
  • the Copilot skill is agent-guidance infrastructure, not production schema/generator behavior
  • splitting these pieces keeps this PR focused on runtime-impacting schema and generation changes

Notable review outcomes addressed here

  • reverted the unnecessary allOf wrapper churn in the relationship index where the wrapper was not required
  • removed brittle $ref sibling behavior from schedule schema definitions
  • replaced unsupported academy deep property refs with reusable named schemas
  • fixed generator handling for explicit x-go-type aliases instead of depending on guessed import names
  • resolved the design-thread concern about breaking Meshery by restoring the intended pointer-slice contract and updating downstream handwritten code accordingly

Validation

Validated locally with:

  • make build
  • go test ./...

Scope after split

This PR is now focused on:

  • generator behavior
  • construct schema additions for credential, role, and schedule
  • schema reference normalization
  • review-driven compatibility fixes required by those changes

This PR no longer includes:

… Go models

- Add OpenAPI schemas for credential, role, schedule, and capability constructs
  under schemas/constructs/v1beta1/{construct}/api.yml
- Generate Go models for credential, role, schedule, and capability packages
  under models/v1beta1/{construct}/ with db struct tags for Pop ORM
- Extend design/api.yml (pattern package) with cloud-specific paths
  (x-internal: ["cloud"]) merged from the former pattern/api.yml
- Update pattern Go model with db tags and additional type aliases

These types serve as the canonical source of truth for meshery-cloud to
import instead of maintaining duplicate local struct definitions.
Copilot AI review requested due to automatic review settings March 17, 2026 19:34
@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly enhances the Meshery Cloud API and data models by introducing new OpenAPI schemas and their corresponding Go models for core constructs like credentials, roles, schedules, and capabilities. The primary goal is to establish a single source of truth for shared types, enabling meshery-cloud to directly import these definitions. This change also expands the design API with cloud-specific endpoints, streamlining the management of infrastructure designs and ensuring consistency across the platform.

Highlights

  • New OpenAPI Schemas: Added new OpenAPI api.yml schemas for credential, role, schedule, and capability constructs under schemas/constructs/v1beta1/ to centralize type definitions.
  • Go Model Generation: Generated corresponding Go models for credential, role, schedule, and capability under models/v1beta1/ with db: struct tags for Pop ORM compatibility.
  • Pattern API Extension: Extended the design/api.yml (which generates the pattern Go package) with new cloud-specific API paths tagged x-internal: ["cloud"] for design management operations.
  • Go Model Enhancements: Updated the pattern Go model with additional type aliases for common identifiers and pagination parameters, and ensured db: tags are present on relevant fields in new models.
Changelog
  • models/v1beta1/capability/capability.go
    • Added new Go model for Capability based on its OpenAPI schema.
  • models/v1beta1/credential/credential.go
    • Added new Go model for Credential including db struct tags for ORM integration and core.Map for the Secret field.
  • models/v1beta1/credential/helpers.go
    • Added EventCategory method to the Credential struct.
  • models/v1beta1/pattern/pattern.go
    • Added Id, Order, Page, Pagesize, and Search type aliases to the pattern Go model.
  • models/v1beta1/role/helpers.go
    • Added EventCategory and String methods to the Role struct.
  • models/v1beta1/role/role.go
    • Added new Go model for Role including db struct tags for ORM integration.
  • models/v1beta1/schedule/helpers.go
    • Added EventCategory method to the Schedule struct.
  • models/v1beta1/schedule/schedule.go
    • Added new Go model for Schedule including db struct tags for ORM integration.
  • schemas/constructs/v1beta1/capability/api.yml
    • Added new OpenAPI schema for Capability with definitions for provider capabilities and UI extensions.
  • schemas/constructs/v1beta1/credential/api.yml
    • Added new OpenAPI schema for Credential including API paths for managing user credentials.
  • schemas/constructs/v1beta1/design/api.yml
    • Updated OpenAPI schema for design to include new cloud-specific API paths for design management (get, save, delete, clone, download, upload) and common parameters/responses.
  • schemas/constructs/v1beta1/role/api.yml
    • Added new OpenAPI schema for Role including API paths for managing roles and role assignments within organizations.
  • schemas/constructs/v1beta1/schedule/api.yml
    • Added new OpenAPI schema for Schedule including API paths for managing user schedules.
Activity
  • The author, leecalcote, created this pull request to introduce new schemas and Go models for various Meshery constructs.
  • The changes involve extensive additions of OpenAPI YAML files and their corresponding generated Go code.
  • No human review comments or approvals have been recorded yet for this pull request.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces OpenAPI schemas and corresponding Go models for credential, role, schedule, and capability. It also expands the design schema with new cloud-specific endpoints. The changes are extensive and foundational for standardizing types.

My review focuses on the new schema definitions and helper functions. I've identified a few issues in the required fields of the new schemas, where server-generated fields like id, created_at, and user_id are incorrectly marked as required from the client. This would cause issues with resource creation endpoints. I've also suggested an improvement in error handling in one of the new Go helper files.

Overall, this is a significant and valuable contribution to making meshery/schemas the single source of truth for shared types.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds new v1beta1 construct OpenAPI specs and corresponding Go types to make Meshery Cloud’s credential/role/schedule/capability models shared via meshery/schemas, and extends the design (pattern) API with cloud-internal endpoints.

Changes:

  • Added OpenAPI api.yml specs for credential, role, schedule, and capability constructs (cloud-internal endpoints).
  • Expanded design/api.yml with cloud-specific pattern endpoints and shared parameters/responses.
  • Added/updated Go model packages under models/v1beta1/* to match the new/updated specs.

Reviewed changes

Copilot reviewed 13 out of 13 changed files in this pull request and generated 13 comments.

Show a summary per file
File Description
schemas/constructs/v1beta1/credential/api.yml New credential endpoints and schemas, including db tags and paging model
schemas/constructs/v1beta1/role/api.yml New role/keychain/holder APIs and schemas, including mapping and paging
schemas/constructs/v1beta1/schedule/api.yml New schedule APIs and schemas
schemas/constructs/v1beta1/capability/api.yml New capability handshake API and schemas
schemas/constructs/v1beta1/design/api.yml Expanded design/pattern API surface for cloud-internal endpoints
models/v1beta1/credential/credential.go Generated Credential and CredentialPage Go types
models/v1beta1/credential/helpers.go Adds EventCategory hook for Credential
models/v1beta1/role/role.go Generated Role-related Go types
models/v1beta1/role/helpers.go Adds EventCategory and String helper for Role
models/v1beta1/schedule/schedule.go Generated Schedule and SchedulePage Go types
models/v1beta1/schedule/helpers.go Adds EventCategory hook for Schedule
models/v1beta1/capability/capability.go Generated Capability Go types
models/v1beta1/pattern/pattern.go Adds additional type aliases in the pattern package

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

marblom007 and others added 2 commits March 17, 2026 16:41
- credential/api.yml: move DELETE to /credentials/{id} path param (was query param)
- credential/api.yml: use core created_at/updated_at $refs; drop redundant x-oapi-codegen-extra-tags
- role/api.yml: remove id/created_at/updated_at from Role required list (server-managed fields)
- role/api.yml: use core created_at/updated_at $refs for Role and RolesKeychainsMapping
- role/api.yml: rename getKeyChains → getKeychains, unAssignKeychainFromRole → unassignKeychainFromRole
- schedule/api.yml: add required list to SchedulePage (page, page_size, total_count, schedules)
- schedule/api.yml: use core created_at/updated_at $refs; drop redundant x-oapi-codegen-extra-tags
- design/api.yml: add root-level security: [{jwt: []}] block
- credential/helpers.go: fix EventCategory to return "credential" (was "connection")
- role/helpers.go: handle json.Marshal error in String() method
- Remove generated Go model files from commit per AGENTS.md (auto-generated by build pipeline)
Signed-off-by: Lee Calcote <leecalcote@gmail.com>
@leecalcote
Copy link
Copy Markdown
Member Author

/gemini review

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces new OpenAPI schemas and corresponding Go models for credential, role, schedule, and capability constructs, which is a great step towards a unified type system. The changes also expand the design API.

My review has identified a few critical issues. A core file (pattern.go) is removed, which will break the build due to existing dependencies. Additionally, there are inconsistencies in the new schemas, particularly around required fields for resource creation (id, created_at, updated_at), which could lead to issues for API clients. Please see the detailed comments for suggestions on how to resolve these.

Signed-off-by: Lee Calcote <lee.calcote@layer5.io>
Signed-off-by: Lee Calcote <lee.calcote@layer5.io>
Signed-off-by: Lee Calcote <lee.calcote@layer5.io>
Signed-off-by: Lee Calcote <lee.calcote@layer5.io>
@github-actions github-actions bot added the area/ci Continuous integration | Build and release label Mar 18, 2026
@leecalcote
Copy link
Copy Markdown
Member Author

/gemini review

leecalcote and others added 13 commits March 17, 2026 20:16
Added a comprehensive design document outlining the implementation of schema-backed validation methods for Meshery's entity types. This document addresses validation architecture, dependency management, and proposed solutions for integrating validation into the Meshery ecosystem.

Signed-off-by: Lee Calcote <lee.calcote@layer5.io>
Signed-off-by: marblom007 <158522975+marblom007@users.noreply.github.com>
… Go models

- Add OpenAPI schemas for credential, role, schedule, and capability constructs
  under schemas/constructs/v1beta1/{construct}/api.yml
- Generate Go models for credential, role, schedule, and capability packages
  under models/v1beta1/{construct}/ with db struct tags for Pop ORM
- Extend design/api.yml (pattern package) with cloud-specific paths
  (x-internal: ["cloud"]) merged from the former pattern/api.yml
- Update pattern Go model with db tags and additional type aliases

These types serve as the canonical source of truth for meshery-cloud to
import instead of maintaining duplicate local struct definitions.

Signed-off-by: marblom007 <158522975+marblom007@users.noreply.github.com>
- credential/api.yml: move DELETE to /credentials/{id} path param (was query param)
- credential/api.yml: use core created_at/updated_at $refs; drop redundant x-oapi-codegen-extra-tags
- role/api.yml: remove id/created_at/updated_at from Role required list (server-managed fields)
- role/api.yml: use core created_at/updated_at $refs for Role and RolesKeychainsMapping
- role/api.yml: rename getKeyChains → getKeychains, unAssignKeychainFromRole → unassignKeychainFromRole
- schedule/api.yml: add required list to SchedulePage (page, page_size, total_count, schedules)
- schedule/api.yml: use core created_at/updated_at $refs; drop redundant x-oapi-codegen-extra-tags
- design/api.yml: add root-level security: [{jwt: []}] block
- credential/helpers.go: fix EventCategory to return "credential" (was "connection")
- role/helpers.go: handle json.Marshal error in String() method
- Remove generated Go model files from commit per AGENTS.md (auto-generated by build pipeline)

Signed-off-by: marblom007 <158522975+marblom007@users.noreply.github.com>
Signed-off-by: Lee Calcote <lee.calcote@layer5.io>
Signed-off-by: marblom007 <158522975+marblom007@users.noreply.github.com>
Signed-off-by: Lee Calcote <lee.calcote@layer5.io>
Signed-off-by: marblom007 <158522975+marblom007@users.noreply.github.com>
Signed-off-by: Lee Calcote <lee.calcote@layer5.io>
Signed-off-by: marblom007 <158522975+marblom007@users.noreply.github.com>
Signed-off-by: Lee Calcote <lee.calcote@layer5.io>
Signed-off-by: marblom007 <158522975+marblom007@users.noreply.github.com>
Bumps [minimatch](https://github.com/isaacs/minimatch) from 10.1.1 to 10.2.4.
- [Changelog](https://github.com/isaacs/minimatch/blob/main/changelog.md)
- [Commits](isaacs/minimatch@v10.1.1...v10.2.4)

---
updated-dependencies:
- dependency-name: minimatch
  dependency-version: 10.2.4
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Signed-off-by: marblom007 <158522975+marblom007@users.noreply.github.com>
Signed-off-by: meshery <ci@meshery.io>
Signed-off-by: marblom007 <158522975+marblom007@users.noreply.github.com>
Signed-off-by: Raunak Madan <143412156+CodexRaunak@users.noreply.github.com>
Signed-off-by: marblom007 <158522975+marblom007@users.noreply.github.com>
…ct information for Meshery components

Signed-off-by: marblom007 <158522975+marblom007@users.noreply.github.com>
Signed-off-by: meshery <ci@meshery.io>
Signed-off-by: marblom007 <158522975+marblom007@users.noreply.github.com>
Signed-off-by: meshery <ci@meshery.io>
Signed-off-by: marblom007 <158522975+marblom007@users.noreply.github.com>
Move agent config update and skill evaluation workspace to a
separate PR to keep this branch focused on schema and code
generator changes.
@fitzergerald
Copy link
Copy Markdown
Member

Code review

Found 1 issue:

  1. ModelId field in ComponentDefinition lost json:"-", yaml:"-", and gorm index tags despite the schema explicitly requiring them. The source schema component.yaml declares x-oapi-codegen-extra-tags: { gorm: "index:idx_component_definition_dbs_model_id,column:model_id", yaml: "-", json: "-" } for modelId, but the generated Go code has json:"modelId" yaml:"modelId" with no gorm tag. This means the internal DB foreign key UUID is now leaked in all JSON/YAML API responses (was previously hidden with json:"-"), and the GORM database index idx_component_definition_dbs_model_id is no longer managed. Root cause: addSchemaExtraTags() in build/generate-golang.js skips json/yaml tags when they already exist (if (updatedTags.includes(tagName + ':"'))) so it cannot override the generator's default json:"modelId" with the schema-declared json:"-". The gorm tag (which has no pre-existing value to conflict with) is also missing, suggesting the extra tags may not be collected for this field at all.

// ModelId A Universally Unique Identifier used to uniquely identify entities in Meshery. The UUID core definition is used across different schemas.
ModelId corev1alpha1.Uuid `json:"modelId" yaml:"modelId"`

Schema source of truth:

modelId:
$ref: ../../v1alpha1/core/api.yml#/components/schemas/uuid
description: ModelId is the foreign key to the model to which the component belongs.
x-oapi-codegen-extra-tags:
gorm: index:idx_component_definition_dbs_model_id,column:model_id
yaml: "-"
json: "-"

Generator root cause:

for (const [tagName, tagValue] of Object.entries(propertyTags.extraTags)) {
if (updatedTags.includes(`${tagName}:"`)) {
continue;
}

🤖 Generated with Claude Code

- If this code review was useful, please react with 👍. Otherwise, react with 👎.

@leecalcote leecalcote changed the title Code generator scripts refactor; Add credential, role, schedule, and capability construct schemas with Go models Code generator scripts refactor; Add credential, role, and schedule construct schemas with Go models Mar 18, 2026
@leecalcote leecalcote requested a review from Copilot March 18, 2026 20:45
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Refactors the schema-driven code generation pipeline (Go + TypeScript) to use construct source schemas as the primary input, adds new v1beta1 constructs (credential/role/schedule), and updates schemas/models to keep downstream Meshery consumers compatible with regenerated types.

Changes:

  • Added new v1beta1 construct schemas for credential, role, and schedule, plus corresponding generated Go models/helpers.
  • Normalized $ref entrypoints to construct api.yml#/components/... and made cross-package Go import aliases explicit via schema metadata.
  • Updated generators/config (Go helper generation + TypeScript schema export typing) and regenerated/adjusted Go models accordingly.

Reviewed changes

Copilot reviewed 76 out of 119 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
schemas/constructs/v1beta1/team/team.yaml Switches deleted_at to core nullTime reference (removes manual Go type/import overrides).
schemas/constructs/v1beta1/team/api.yml Normalizes auth scheme casing, retargets time refs to named core schemas, adds DB tags for mapping fields.
schemas/constructs/v1beta1/subscription/api.yml Adds explicit Go import alias to stabilize generated cross-package type references.
schemas/constructs/v1beta1/schedule/api.yml Introduces new Schedule construct OpenAPI surface + schemas.
schemas/constructs/v1beta1/role/api.yml Introduces new Role construct OpenAPI surface + schemas.
schemas/constructs/v1beta1/model/model.yaml Normalizes refs to construct api.yml entrypoints and adds explicit Go import aliases.
schemas/constructs/v1beta1/model/api.yml Removes unnecessary allOf wrappers and inlines/normalizes Model schema fields.
schemas/constructs/v1beta1/keychain/api.yml Normalizes item $ref to local component schema anchor.
schemas/constructs/v1beta1/key/api.yml Normalizes item $ref to local component schema anchor.
schemas/constructs/v1beta1/feature/api.yml Adds explicit Go import alias for plan reference.
schemas/constructs/v1beta1/evaluation/api.yml Retargets design refs to design api.yml and stabilizes Go import aliasing.
schemas/constructs/v1beta1/environment/environment.yaml Switches deleted_at to core nullTime reference (removes manual Go type/import overrides).
schemas/constructs/v1beta1/design/design.yaml Restores pointer-slice contract via x-go-type and normalizes item refs.
schemas/constructs/v1beta1/design/api.yml Expands design endpoints, adds security/responses/params blocks, stabilizes cross-package Go imports.
schemas/constructs/v1beta1/credential/api.yml Introduces new Credential construct OpenAPI surface + schemas.
schemas/constructs/v1beta1/connection/connection.yaml Normalizes deleted_at to nullTime, stabilizes env item ref + Go import alias.
schemas/constructs/v1beta1/component/component.yaml Normalizes refs to model api.yml schemas and stabilizes type imports/aliases.
schemas/constructs/v1beta1/academy/api.yml Replaces deep refs with named reusable schemas; stabilizes invitation imports and adds typed helper schemas.
schemas/constructs/v1alpha3/relationship/relationship.yaml Stabilizes model/capability cross-package import aliasing.
schemas/constructs/v1alpha1/core/api.yml Fixes semver description bounds/text.
models/v1beta1/workspace/workspace.go Regenerates model types to use core v1alpha1 primitives instead of stdlib/sql/uuid/time types.
models/v1beta1/user/zz_generated.helpers.go Adds generated scan/value helpers and event category for user package.
models/v1beta1/user/user.go Updates user models to use core v1alpha1 primitives and stabilizes nested config structures.
models/v1beta1/user/helpers.go Removes hand-written helpers superseded by generated helpers.
models/v1beta1/team/zz_generated.helpers.go Adds generated event category for team package.
models/v1beta1/team/team_helper.go Removes hand-written event category helper superseded by generated helper.
models/v1beta1/team/team.go Regenerates model types to use core v1alpha1 primitives and updates generated param aliases.
models/v1beta1/subscription/zz_generated.helpers.go Adds generated event category for subscription package.
models/v1beta1/subscription/subscription.go Regenerates subscription models; adjusts enum constant names and updates plan import aliasing.
models/v1beta1/subscription/helpers.go Adds deprecated constant aliases for renamed PaymentProcessor values.
models/v1beta1/schedule/zz_generated.helpers.go Adds generated event category for schedule package.
models/v1beta1/schedule/schedule.go Adds generated schedule models from new Schedule construct.
models/v1beta1/role/zz_generated.helpers.go Adds generated event category for role package.
models/v1beta1/role/role.go Adds generated role models from new Role construct.
models/v1beta1/role/helpers.go Adds Role stringer helper.
models/v1beta1/plan/zz_generated.helpers.go Adds generated event category for plan package.
models/v1beta1/plan/plan.go Regenerates plan model to use core v1alpha1 UUID.
models/v1beta1/plan/helpers.go Removes hand-written event category helper superseded by generated helper.
models/v1beta1/pattern/pattern.go Updates pattern models and cross-package imports/types after schema refactor and regen.
models/v1beta1/pattern/evaluation_models.go Renames imported core alias and updates schemaVersion type.
models/v1beta1/pattern/design_conversion.go Updates conversion logic for regenerated component/model types.
models/v1beta1/organization/zz_generated.helpers.go Adds generated json scan/value helpers and event category for organization package.
models/v1beta1/organization/organization.go Regenerates organization models to use core v1alpha1 primitives and replaces inline structs with named types.
models/v1beta1/organization/helpers.go Removes hand-written scan/value + event helpers superseded by generated helper.
models/v1beta1/model/model.go Regenerates model definitions to use core v1alpha1 primitives and normalized schema shapes/types.
models/v1beta1/keychain/zz_generated.helpers.go Adds generated header to helpers file.
models/v1beta1/keychain/keychain.go Regenerates keychain models to use core v1alpha1 primitives; updates generated param aliases.
models/v1beta1/key/zz_generated.helpers.go Adds generated header to helpers file.
models/v1beta1/key/key.go Regenerates key models to use core v1alpha1 primitives; updates generated param aliases.
models/v1beta1/invitation/invitation.go Updates invitation to use core v1alpha1 UUID types.
models/v1beta1/feature/feature.go Updates feature model to use core v1alpha1 primitives and plan import aliasing.
models/v1beta1/event/event.go Updates event request UUID slices to use core v1alpha1 UUID type.
models/v1beta1/evaluation/evaluation.go Updates evaluation to depend on pattern v1beta1 import alias and typed item declarations.
models/v1beta1/environment/zz_generated.helpers.go Adds generated event category for environment package.
models/v1beta1/environment/environment_helper.go Removes hand-written event category helper superseded by generated helper.
models/v1beta1/environment/environment.go Regenerates environment models to use core v1alpha1 primitives and updates generated param aliases.
models/v1beta1/credential/zz_generated.helpers.go Adds generated event category for credential package.
models/v1beta1/credential/credential.go Adds generated credential models from new Credential construct.
models/v1beta1/connection/zz_generated.helpers.go Adds generated event categories for connection types.
models/v1beta1/connection/connection_helper.go Fixes Create() to pass correct pointer type; adds deprecated enum constant aliases.
models/v1beta1/connection/connection.go Regenerates connection models to use core v1alpha1 primitives; introduces ConnectionPage status/type changes.
models/v1beta1/component/component_helper.go Aligns Styles alias to core type + updates SVG replacement logic.
models/v1beta1/category/category.go Updates category to use core v1alpha1 UUID type.
models/v1beta1/badge/badge.go Updates badge to use core v1alpha1 UUID/time primitives.
models/v1beta1/academy/zz_generated.helpers.go Adds generated scan/value helpers for map-backed types.
models/v1beta1/academy/helpers.go Removes hand-written scan/value helpers superseded by generated helper.
models/v1beta1/academy/academy.go Regenerates academy models to use core v1alpha1 primitives and stabilizes invitation import aliasing.
models/v1alpha3/relationship/relationship_helper.go Adds deprecated type/const aliases to preserve compatibility with renamed generated types.
models/v1alpha3/relationship/relationship.go Updates relationship models to use core v1alpha1 primitives; renames patch types and stabilizes model import aliasing.
models/v1alpha1/core/core.go Regenerates core types/enums; consolidates enums and tightens semantic string types.
models/v1alpha1/capability/capability.go Updates capability fields to use core v1alpha1 string/version primitives; removes older enum type.
build/openapi.config.yml Empties base import-mapping in favor of generator-derived reachable-$ref mapping.
build/lib/generated-go-helpers.js Adds generator for per-package Go helper files (scan/value + event category).
build/generate-typescript.js Changes TS schema constant typing mechanism from as const to satisfies.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@hortison hortison requested a review from Copilot March 18, 2026 21:55
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Refactors the schema→Go/TypeScript generation pipeline to treat construct source schemas as the source of truth, adds new v1beta1 constructs (credential/role/schedule), and normalizes $ref boundaries/import aliases to keep generated Go models compatible with downstream Meshery consumers.

Changes:

  • Added v1beta1 construct schemas for credential, role, and schedule (OpenAPI specs + generated Go models/helpers).
  • Normalized many schema references to construct api.yml#/components/... entrypoints and stabilized Go import aliases via x-go-type-import.name.
  • Updated generated Go models and introduced a generator-driven helpers mechanism (zz_generated.helpers.go) for EventCategory + Scan/Value helpers.

Reviewed changes

Copilot reviewed 76 out of 119 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
schemas/constructs/v1beta1/team/team.yaml Switch deleted_at to nullTime ref for consistent nullability modeling.
schemas/constructs/v1beta1/team/api.yml Normalize security scheme casing and align timestamps/DB tags with core refs.
schemas/constructs/v1beta1/subscription/api.yml Stabilize plan import alias (planv1beta1) for deterministic generated code.
schemas/constructs/v1beta1/schedule/api.yml Add new Schedule construct schema (paths + Schedule/SchedulePage schemas).
schemas/constructs/v1beta1/role/api.yml Add new Role construct schema (role assignment APIs + schemas).
schemas/constructs/v1beta1/model/model.yaml Normalize refs to construct api.yml entrypoints and add explicit Go import aliases.
schemas/constructs/v1beta1/model/api.yml Remove unnecessary allOf wrappers and inline/clarify request fields.
schemas/constructs/v1beta1/keychain/api.yml Normalize intra-doc $ref to #/components/schemas/....
schemas/constructs/v1beta1/key/api.yml Normalize intra-doc $ref to #/components/schemas/....
schemas/constructs/v1beta1/feature/api.yml Stabilize plan import alias (planv1beta1) for deterministic generated code.
schemas/constructs/v1beta1/evaluation/api.yml Normalize design ref to design/api.yml#/... and stabilize Go import alias.
schemas/constructs/v1beta1/environment/environment.yaml Switch deleted_at to nullTime ref for consistent nullability modeling.
schemas/constructs/v1beta1/design/design.yaml Restore pointer-slice intent via x-go-type + explicit import aliasing.
schemas/constructs/v1beta1/design/api.yml Expand design REST surface and stabilize catalog import aliasing.
schemas/constructs/v1beta1/credential/api.yml Add new Credential construct schema (CRUD-like endpoints + schemas).
schemas/constructs/v1beta1/connection/connection.yaml Normalize deleted_at + environment refs and stabilize env import alias.
schemas/constructs/v1beta1/component/component.yaml Normalize model/capability refs and stabilize cross-package import aliases.
schemas/constructs/v1beta1/academy/api.yml Replace deep refs with named schemas; stabilize invitation import alias.
schemas/constructs/v1alpha3/relationship/relationship.yaml Stabilize model/capability import aliases for deterministic generation.
schemas/constructs/v1alpha1/core/api.yml Fix semver string description / constraints consistency.
models/v1beta1/workspace/workspace.go Migrate primitives to core-v1alpha1 strong types (Uuid/Time/Text/etc).
models/v1beta1/user/zz_generated.helpers.go Add generated Scan/Value + EventCategory helpers for Preference/User.
models/v1beta1/user/user.go Move to core v1alpha1 types and factor SelectedGrafanaConfig types.
models/v1beta1/user/helpers.go Remove handwritten duplicates now generated into zz_generated.helpers.go.
models/v1beta1/team/zz_generated.helpers.go Generate Team EventCategory helper.
models/v1beta1/team/team_helper.go Remove handwritten Team EventCategory (now generated).
models/v1beta1/team/team.go Move to core v1alpha1 strong types and generated alias types.
models/v1beta1/subscription/zz_generated.helpers.go Generate Subscription EventCategory helper.
models/v1beta1/subscription/subscription.go Update plan import aliasing and consolidate payment processor constants.
models/v1beta1/subscription/helpers.go Add deprecated constant aliases to preserve prior exported names.
models/v1beta1/schedule/zz_generated.helpers.go Generate Schedule EventCategory helper.
models/v1beta1/schedule/schedule.go Add generated Go models for schedule construct.
models/v1beta1/role/zz_generated.helpers.go Generate Role EventCategory helper.
models/v1beta1/role/role.go Add generated Go models for role construct.
models/v1beta1/role/helpers.go Add Role String() helper.
models/v1beta1/plan/zz_generated.helpers.go Generate Plan EventCategory helper.
models/v1beta1/plan/plan.go Move plan ID to core v1alpha1 Uuid type.
models/v1beta1/plan/helpers.go Remove handwritten Plan EventCategory (now generated).
models/v1beta1/pattern/pattern.go Update pattern models to new core types and cross-package imports.
models/v1beta1/pattern/evaluation_models.go Rename core import alias for clarity and remove stray whitespace.
models/v1beta1/pattern/design_conversion.go Adjust conversion logic for regenerated types and pointer semantics.
models/v1beta1/organization/zz_generated.helpers.go Generate OrgMetadata Scan/Value + Organization EventCategory.
models/v1beta1/organization/organization.go Migrate to core v1alpha1 strong types; reduce inline anonymous structs.
models/v1beta1/organization/helpers.go Remove handwritten helpers replaced by generated ones.
models/v1beta1/model/model.go Migrate model types to strong core types + stabilized imports; simplify unions.
models/v1beta1/keychain/zz_generated.helpers.go Add generated header and keep EventCategory helper.
models/v1beta1/keychain/keychain.go Migrate keychain primitives to core v1alpha1 types.
models/v1beta1/key/zz_generated.helpers.go Add generated header and keep EventCategory helper.
models/v1beta1/key/key.go Migrate key primitives to core v1alpha1 types.
models/v1beta1/invitation/invitation.go Migrate invitation UUID types to core v1alpha1 Uuid.
models/v1beta1/feature/feature.go Stabilize plan import alias and migrate primitives to core v1alpha1 types.
models/v1beta1/event/event.go Migrate event bulk request IDs to core v1alpha1 Uuid.
models/v1beta1/evaluation/evaluation.go Stabilize pattern import alias and strengthen action payload types.
models/v1beta1/environment/zz_generated.helpers.go Generate Environment EventCategory helper.
models/v1beta1/environment/environment_helper.go Remove handwritten Environment EventCategory (now generated).
models/v1beta1/environment/environment.go Migrate environment primitives to core v1alpha1 types; normalize schemaVersion typing.
models/v1beta1/credential/zz_generated.helpers.go Generate Credential EventCategory helper.
models/v1beta1/credential/credential.go Add generated Go models for credential construct.
models/v1beta1/connection/zz_generated.helpers.go Generate Connection + MesheryInstance EventCategory helpers.
models/v1beta1/connection/connection_helper.go Fix GORM create call and add deprecated status constant aliases.
models/v1beta1/connection/connection.go Migrate primitives to core v1alpha1 types and expand ConnectionPage shape constants.
models/v1beta1/component/component_helper.go Align Styles alias with core type and harden SVG replacement conditions.
models/v1beta1/category/category.go Migrate category ID to core v1alpha1 Uuid.
models/v1beta1/badge/badge.go Migrate badge IDs/timestamps to core v1alpha1 types.
models/v1beta1/academy/zz_generated.helpers.go Generate Scan/Value helpers for Map-backed quiz structs.
models/v1beta1/academy/helpers.go Remove handwritten Scan/Value helpers replaced by generated ones.
models/v1beta1/academy/academy.go Migrate to core v1alpha1 types, stabilize invitation alias, and reduce inline structs.
models/v1alpha3/relationship/relationship_helper.go Add deprecated type/const aliases to preserve older exported names.
models/v1alpha3/relationship/relationship.go Migrate to core types, normalize patch types, and rework metadata/style enums.
models/v1alpha1/core/core.go Consolidate enum constant names and adjust shared scalar aliases (e.g., Endpoint).
models/v1alpha1/capability/capability.go Migrate fields to core scalar types and tighten schemaVersion/semver typing.
build/openapi.config.yml Make base import-mapping empty; rely on generator-derived mappings.
build/lib/generated-go-helpers.js Add generator for zz_generated.helpers.go (EventCategory + Scan/Value helpers).
build/generate-typescript.js Emit TS schemas with satisfies Record<string, unknown> to keep builds reliable.
Comments suppressed due to low confidence (1)

models/v1beta1/subscription/subscription.go:1

  • The JSON/YAML tags for Subscription.ID are ID (uppercase), which is inconsistent with the rest of the models (json:"id") and is very likely to break API serialization/deserialization expectations for consumers. Adjust the schema/generator so the serialized field name is id (lowercase), while keeping the Go field name ID.
// Package subscription provides primitives to interact with the openapi HTTP API.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

@miacycle
Copy link
Copy Markdown
Member

Tracking the exact id -> ID normalization as the dedicated follow-up in #637.

Per decision, PR #629 should not carry a partial repo-wide Id/ID migration while it is already handling generator refactors and new constructs. PR #637 is the separate normalization pass that makes the generator emit ID for exact id fields by default and updates the handwritten/schema references that need to follow.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Refactors the schema-driven Go/TypeScript generation workflow and introduces new v1beta1 construct schemas (credential, role, schedule), while updating existing schemas/models to preserve compatibility for downstream Meshery consumers.

Changes:

  • Added new construct OpenAPI specs for credential, role, and schedule and generated corresponding Go models/helpers.
  • Normalized many construct $ref targets to use construct api.yml#/components/... entrypoints and added explicit Go import aliases for deterministic generation.
  • Updated generated Go models to use shared corev1alpha1 scalar/types (Uuid, Time, SemverString, etc.) and moved repetitive helper methods into generated zz_generated.helpers.go files.

Reviewed changes

Copilot reviewed 76 out of 119 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
schemas/constructs/v1beta1/team/team.yaml Switches deleted_at to shared nullTime schema reference.
schemas/constructs/v1beta1/team/api.yml Normalizes bearer scheme casing; aligns timestamps to core created_at / updated_at; adds db tags.
schemas/constructs/v1beta1/subscription/api.yml Makes plan import alias explicit for deterministic Go generation.
schemas/constructs/v1beta1/schedule/api.yml Adds new Schedule REST surface and schemas.
schemas/constructs/v1beta1/role/api.yml Adds new Role REST surface and schemas.
schemas/constructs/v1beta1/model/model.yaml Normalizes refs to construct API entrypoints; makes import aliases explicit.
schemas/constructs/v1beta1/model/api.yml Removes unnecessary allOf; replaces deep property refs with inline schema definitions.
schemas/constructs/v1beta1/keychain/api.yml Normalizes keychain item refs to schema component entrypoint.
schemas/constructs/v1beta1/key/api.yml Normalizes key item refs to schema component entrypoint.
schemas/constructs/v1beta1/feature/api.yml Makes plan import alias explicit for deterministic Go generation.
schemas/constructs/v1beta1/evaluation/api.yml Updates design refs to construct API entrypoints; makes pattern import alias explicit.
schemas/constructs/v1beta1/environment/environment.yaml Switches deleted_at to shared nullTime schema reference.
schemas/constructs/v1beta1/design/design.yaml Adjusts component/relationship list typing and refs to preserve pointer-slice semantics.
schemas/constructs/v1beta1/design/api.yml Adds a large set of Cloud design endpoints and shared components.
schemas/constructs/v1beta1/credential/api.yml Adds new Credential REST surface and schemas.
schemas/constructs/v1beta1/connection/connection.yaml Switches deleted_at to nullTime; normalizes environment ref; makes env import alias explicit.
schemas/constructs/v1beta1/component/component.yaml Normalizes model/capability refs; makes import aliases explicit.
schemas/constructs/v1beta1/academy/api.yml Replaces brittle deep refs with named reusable schemas; adds explicit invitation import alias.
schemas/constructs/v1alpha3/relationship/relationship.yaml Makes model/capability import aliases explicit; normalizes model refs.
schemas/constructs/v1alpha1/core/api.yml Fixes semver description text/length mismatch.
models/v1beta1/workspace/workspace.go Moves workspace scalars to shared corev1alpha1 types.
models/v1beta1/user/zz_generated.helpers.go Adds generated Scan/Value + EventCategory helpers for user models.
models/v1beta1/user/user.go Switches to shared corev1alpha1 types; refactors selected nested types.
models/v1beta1/user/helpers.go Removes handwritten Scan/Value + EventCategory now generated elsewhere.
models/v1beta1/team/zz_generated.helpers.go Adds generated EventCategory helper for Team.
models/v1beta1/team/team_helper.go Removes handwritten EventCategory helper now generated elsewhere.
models/v1beta1/team/team.go Switches to shared corev1alpha1 types and regenerated aliases.
models/v1beta1/subscription/zz_generated.helpers.go Adds generated EventCategory helper for Subscription.
models/v1beta1/subscription/subscription.go Switches to shared core types; consolidates payment processor enums; updates plan import alias.
models/v1beta1/subscription/helpers.go Adds deprecated compatibility constants for renamed PaymentProcessor values.
models/v1beta1/schedule/zz_generated.helpers.go Adds generated EventCategory helper for Schedule.
models/v1beta1/schedule/schedule.go Adds generated Schedule models using shared core types.
models/v1beta1/role/zz_generated.helpers.go Adds generated EventCategory helper for Role.
models/v1beta1/role/role.go Adds generated Role models using shared core types.
models/v1beta1/role/helpers.go Adds Role.String helper.
models/v1beta1/plan/zz_generated.helpers.go Adds generated EventCategory helper for Plan.
models/v1beta1/plan/plan.go Switches plan ID to shared corev1alpha1.Uuid.
models/v1beta1/plan/helpers.go Removes handwritten EventCategory helper now generated elsewhere.
models/v1beta1/pattern/pattern.go Updates pattern model types/import aliases; modifies component/relationship collection types.
models/v1beta1/pattern/evaluation_models.go Renames import alias and updates schema version type reference.
models/v1beta1/pattern/design_conversion.go Updates conversion logic to match regenerated types and avoid pointer pitfalls.
models/v1beta1/organization/zz_generated.helpers.go Adds generated JSON Scan/Value + EventCategory helpers for Organization.
models/v1beta1/organization/organization.go Switches organization scalars to shared corev1alpha1 types and aliases.
models/v1beta1/organization/helpers.go Removes handwritten helpers now generated elsewhere; reserves file for package-specific helpers.
models/v1beta1/model/model.go Refactors unions and types to use shared core scalars; normalizes imported model references.
models/v1beta1/keychain/zz_generated.helpers.go Adds generated header to helper file.
models/v1beta1/keychain/keychain.go Switches keychain scalars to shared corev1alpha1 types and aliases.
models/v1beta1/key/zz_generated.helpers.go Adds generated header to helper file.
models/v1beta1/key/key.go Switches key scalars to shared corev1alpha1 types and aliases.
models/v1beta1/invitation/invitation.go Switches invitation IDs to shared corev1alpha1.Uuid.
models/v1beta1/feature/feature.go Switches feature scalars to shared core types; updates plan import alias.
models/v1beta1/event/event.go Switches bulk request IDs to shared corev1alpha1.Uuid.
models/v1beta1/evaluation/evaluation.go Updates pattern import alias and uses typed declarations in ops.
models/v1beta1/environment/zz_generated.helpers.go Adds generated EventCategory helper for Environment.
models/v1beta1/environment/environment_helper.go Removes handwritten EventCategory helper now generated elsewhere.
models/v1beta1/environment/environment.go Switches environment scalars to shared core types; updates deleted_at typing.
models/v1beta1/credential/zz_generated.helpers.go Adds generated EventCategory helper for Credential.
models/v1beta1/credential/credential.go Adds generated Credential models using shared core types and core Map.
models/v1beta1/connection/zz_generated.helpers.go Adds generated EventCategory helpers for Connection and MesheryInstance.
models/v1beta1/connection/connection_helper.go Adjusts Create() db call; adds deprecated compatibility constants for renamed status values.
models/v1beta1/connection/connection.go Switches connection scalars to shared core types; changes ConnectionPage shape/types.
models/v1beta1/component/component_helper.go Aligns Styles alias with core ComponentStyles; refines SVG replacement conditions.
models/v1beta1/category/category.go Switches category ID to shared corev1alpha1.Uuid.
models/v1beta1/badge/badge.go Switches badge scalars to shared core types.
models/v1beta1/academy/zz_generated.helpers.go Adds generated Scan/Value helpers for map-backed types.
models/v1beta1/academy/helpers.go Removes handwritten Scan/Value helpers now generated elsewhere.
models/v1beta1/academy/academy.go Aligns academy types/aliases with new named schemas and shared core types.
models/v1alpha3/relationship/relationship_helper.go Adds deprecated type/constant aliases for renamed generated symbols.
models/v1alpha3/relationship/relationship.go Switches IDs/scalars to shared core types; renames/reshapes selector patch types; adds arrow-shape enum.
models/v1alpha1/core/core.go Consolidates some enums; changes Endpoint alias; normalizes Shapes; prunes redundant union variant.
models/v1alpha1/capability/capability.go Switches string fields to shared core scalar types; uses core semver/schemaVersion types.
build/openapi.config.yml Clears base import-mapping and documents generator-owned augmentation.
build/lib/generated-go-helpers.js Adds generator for per-package zz_generated.helpers.go (event category + Scan/Value helpers).
build/generate-typescript.js Changes schema constant typing to use satisfies Record<string, unknown>.
Comments suppressed due to low confidence (1)

models/v1beta1/subscription/subscription.go:1

  • Using corev1alpha1.SqlNullTime for DeletedAt is likely to serialize as a struct ({\"Time\":...,\"Valid\":...}) rather than the intended timestamp-or-null shape used elsewhere (many other models use corev1alpha1.NullTime). If SqlNullTime is an alias of database/sql.NullTime, this will be a breaking API behavior for JSON/YAML. Prefer corev1alpha1.NullTime (or ensure the chosen null-time type implements the desired JSON/YAML marshaling consistently).
// Package subscription provides primitives to interact with the openapi HTTP API.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@simihablo simihablo requested a review from Copilot March 18, 2026 22:24
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Refactors schema-driven Go/TypeScript generation and introduces new v1beta1 construct schemas (credential, role, schedule) while normalizing $refs and updating generated Go models/helpers to maintain downstream compatibility.

Changes:

  • Added new v1beta1 construct OpenAPI specs for credential, role, and schedule, plus supporting generated models/helpers.
  • Normalized construct $ref entrypoints toward api.yml#/components/... and made Go import aliases deterministic via x-go-type-import.name.
  • Updated generated Go models/helpers across multiple packages (IDs/timestamps/types, helper generation, compatibility aliases).

Reviewed changes

Copilot reviewed 76 out of 119 changed files in this pull request and generated 13 comments.

Show a summary per file
File Description
schemas/constructs/v1beta1/team/team.yaml Switches deleted_at to core nullTime schema reference.
schemas/constructs/v1beta1/team/api.yml Normalizes JWT bearer scheme casing; aligns timestamp refs/tags.
schemas/constructs/v1beta1/subscription/api.yml Makes plan import alias explicit for deterministic Go generation.
schemas/constructs/v1beta1/schedule/api.yml Adds schedule construct OpenAPI schema and endpoints.
schemas/constructs/v1beta1/role/api.yml Adds role construct OpenAPI schema and endpoints.
schemas/constructs/v1beta1/model/model.yaml Normalizes refs to api.yml#/components/... and pins Go import aliases.
schemas/constructs/v1beta1/model/api.yml Removes unnecessary allOf wrapper; replaces deep refs with explicit schemas.
schemas/constructs/v1beta1/keychain/api.yml Avoids local-file $ref in favor of #/components/schemas/....
schemas/constructs/v1beta1/key/api.yml Avoids local-file $ref in favor of #/components/schemas/....
schemas/constructs/v1beta1/feature/api.yml Makes plan import alias explicit for deterministic Go generation.
schemas/constructs/v1beta1/evaluation/api.yml Normalizes design refs and uses pinned import alias for pattern types.
schemas/constructs/v1beta1/environment/environment.yaml Switches deleted_at to core nullTime schema reference.
schemas/constructs/v1beta1/design/design.yaml Forces pointer-slice Go types and explicit import aliases for items.
schemas/constructs/v1beta1/design/api.yml Adds/expands Cloud endpoints and normalizes referenced types/import aliases.
schemas/constructs/v1beta1/credential/api.yml Adds credential construct OpenAPI schema and endpoints.
schemas/constructs/v1beta1/connection/connection.yaml Switches deleted_at to nullTime; normalizes environment refs/import aliasing.
schemas/constructs/v1beta1/component/component.yaml Normalizes model refs and pins import aliases for cross-package types.
schemas/constructs/v1beta1/academy/api.yml Replaces deep refs with named schemas; pins invitation import alias.
schemas/constructs/v1alpha3/relationship/relationship.yaml Pins model/capability import aliases; normalizes $ref entrypoints.
schemas/constructs/v1alpha1/core/api.yml Fixes semverString description bounds/text.
models/v1beta1/workspace/workspace.go Moves IDs/timestamps/text to shared core types (v1alpha1/core).
models/v1beta1/user/zz_generated.helpers.go Introduces generated scan/value + event category helpers.
models/v1beta1/user/user.go Replaces uuid/time usage with shared core types; restructures nested config types.
models/v1beta1/user/helpers.go Removes handwritten helpers now generated elsewhere.
models/v1beta1/team/zz_generated.helpers.go Adds generated EventCategory() helper.
models/v1beta1/team/team_helper.go Removes handwritten helper replaced by generated helper.
models/v1beta1/team/team.go Moves IDs/timestamps/text to shared core types; adjusts paging aliases.
models/v1beta1/subscription/zz_generated.helpers.go Adds generated EventCategory() helper.
models/v1beta1/subscription/subscription.go Renames enum constants; replaces uuid/time/sql types with shared core types + plan alias.
models/v1beta1/subscription/helpers.go Adds deprecated compatibility aliases for renamed constants.
models/v1beta1/schedule/zz_generated.helpers.go Adds generated EventCategory() helper.
models/v1beta1/schedule/schedule.go Adds generated schedule Go models.
models/v1beta1/role/zz_generated.helpers.go Adds generated EventCategory() helper.
models/v1beta1/role/role.go Adds generated role Go models.
models/v1beta1/role/helpers.go Adds handwritten String() helper for Role.
models/v1beta1/plan/zz_generated.helpers.go Adds generated EventCategory() helper.
models/v1beta1/plan/plan.go Switches UUID type to shared core type.
models/v1beta1/plan/helpers.go Removes handwritten helper replaced by generated helper.
models/v1beta1/pattern/pattern.go Updates imports/types to use pinned aliases and shared core types.
models/v1beta1/pattern/evaluation_models.go Renames core import alias for clarity/consistency.
models/v1beta1/pattern/design_conversion.go Updates conversion logic to match regenerated types (pointer/id handling).
models/v1beta1/organization/zz_generated.helpers.go Introduces generated scan/value + event category helpers.
models/v1beta1/organization/organization.go Switches uuid/time/sql types to shared core aliases and reuses named structs.
models/v1beta1/organization/helpers.go Removes handwritten helper implementations now generated elsewhere.
models/v1beta1/model/model.go Refactors types/import aliases; normalizes nested structs; updates semver fields.
models/v1beta1/keychain/zz_generated.helpers.go Marks helper file as generated.
models/v1beta1/keychain/keychain.go Switches uuid/time/sql types to shared core types; normalizes paging aliases.
models/v1beta1/key/zz_generated.helpers.go Marks helper file as generated.
models/v1beta1/key/key.go Switches uuid/time/sql types to shared core types; normalizes paging aliases.
models/v1beta1/invitation/invitation.go Switches UUID types to shared core types.
models/v1beta1/feature/feature.go Switches time/uuid/plan imports to shared core + pinned plan alias.
models/v1beta1/event/event.go Switches UUID arrays to shared core UUID type.
models/v1beta1/evaluation/evaluation.go Pins pattern import alias and strengthens action item types.
models/v1beta1/environment/zz_generated.helpers.go Adds generated EventCategory() helper.
models/v1beta1/environment/environment_helper.go Removes handwritten helper replaced by generated helper.
models/v1beta1/environment/environment.go Switches IDs/timestamps/text to shared core types; aligns schemaVersion type.
models/v1beta1/credential/zz_generated.helpers.go Adds generated EventCategory() helper.
models/v1beta1/credential/credential.go Adds generated credential Go models.
models/v1beta1/connection/zz_generated.helpers.go Adds generated EventCategory() helpers.
models/v1beta1/connection/connection_helper.go Fixes GORM create call; adds deprecated compatibility constants.
models/v1beta1/connection/connection.go Switches IDs/timestamps to shared core types; restructures page responses.
models/v1beta1/component/component_helper.go Updates style type alias and SVG replacement logic to match regenerated style type.
models/v1beta1/category/category.go Switches UUID to shared core UUID type.
models/v1beta1/badge/badge.go Switches UUID/CreatedAt/UpdatedAt to shared core types.
models/v1beta1/academy/zz_generated.helpers.go Adds generated scan/value helpers for JSONB-backed structs.
models/v1beta1/academy/helpers.go Removes handwritten scan/value helpers replaced by generated equivalents.
models/v1beta1/academy/academy.go Pins invitation import alias; switches many IDs/timestamps to shared core types.
models/v1alpha3/relationship/relationship_helper.go Adds deprecated aliases to preserve pre-rename identifiers.
models/v1alpha3/relationship/relationship.go Normalizes core/model/capability types and enum constant naming.
models/v1alpha1/core/core.go Renames several exported constants/types; adjusts Endpoint/Semver docs and UUID usages.
models/v1alpha1/capability/capability.go Replaces several string fields with shared core types (InputString/Semver/VersionString).
build/openapi.config.yml Clears static import-mapping in favor of generator-derived mapping.
build/lib/generated-go-helpers.js Adds generator for package-scoped Go helper methods (scan/value/event category).
build/generate-typescript.js Emits TS schema constants using satisfies Record<string, unknown> for buildability.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

path: github.com/meshery/schemas/models/v1beta1/environment
$ref: ../environment/environment.yaml
name: environmentv1beta1
$ref: ../environment/api.yml#/components/schemas/environment
`const ${pascalName}Schema = ` +
jsonContent +
` as const;\n\nexport default ${pascalName}Schema;\n`;
` satisfies Record<string, unknown>;\n\nexport default ${pascalName}Schema;\n`;
json: "invite_id"
yaml: "invite_id"

AcademyCirriculaWorkspaceId:
json: "workspace_id"
yaml: "workspace_id"

AcademyCirriculaCreatedAt:
json: "created_at"
yaml: "created_at"

AcademyCirriculaUpdatedAt:
json: "updated_at"
yaml: "updated_at"

AcademyCirriculaDeletedAt:
json: "deleted_at"
yaml: "deleted_at"

AcademyCirriculaMetadata:
@miacycle miacycle requested a review from Copilot March 18, 2026 22:42
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Refactors schema-driven code generation (Go + TypeScript) to use source construct schemas as the source of truth, adds new v1beta1 constructs (credential/role/schedule), and applies schema/model compatibility adjustments for downstream Meshery consumers.

Changes:

  • Added new v1beta1 construct OpenAPI schemas for credential, role, and schedule, plus normalized several construct $ref entrypoints.
  • Updated multiple schemas to stabilize Go type generation (explicit import aliases, nullTime usage, ref normalization).
  • Regenerated/adjusted Go models and introduced generated helper files for Scan/Value + EventCategory methods.

Reviewed changes

Copilot reviewed 77 out of 120 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
schemas/constructs/v1beta1/team/team.yaml Switches deleted_at to core nullTime schema and removes ad-hoc Go type/import overrides.
schemas/constructs/v1beta1/team/api.yml Normalizes bearer scheme casing and aligns created/updated/deleted refs + db tags.
schemas/constructs/v1beta1/subscription/api.yml Makes plan import alias explicit for deterministic cross-package Go generation.
schemas/constructs/v1beta1/schedule/api.yml Introduces schedule construct OpenAPI spec and schemas.
schemas/constructs/v1beta1/role/api.yml Introduces role construct OpenAPI spec and schemas.
schemas/constructs/v1beta1/model/model.yaml Normalizes refs and makes cross-package Go import aliases explicit for model dependencies.
schemas/constructs/v1beta1/model/api.yml Removes unnecessary allOf wrapper and replaces deep property refs with named schema definitions.
schemas/constructs/v1beta1/keychain/api.yml Replaces local file ref with components schema ref for keychain items.
schemas/constructs/v1beta1/key/api.yml Replaces local file ref with components schema ref for key items.
schemas/constructs/v1beta1/feature/api.yml Makes plan import alias explicit for deterministic cross-package Go generation.
schemas/constructs/v1beta1/evaluation/api.yml Normalizes design refs to construct API entrypoint and adds explicit Go import alias.
schemas/constructs/v1beta1/environment/environment.yaml Switches deleted_at to core nullTime schema and removes ad-hoc Go type/import overrides.
schemas/constructs/v1beta1/design/design.yaml Adjusts component/relationship slice typing and ref entrypoints to preserve expected Go shapes.
schemas/constructs/v1beta1/design/api.yml Adds Cloud design REST paths and stabilizes cross-package Go type imports.
schemas/constructs/v1beta1/credential/api.yml Introduces credential construct OpenAPI spec and schemas.
schemas/constructs/v1beta1/connection/connection_page.yaml Sets connections array Go typing intent for pointer-slice.
schemas/constructs/v1beta1/connection/connection.yaml Normalizes deleted_at and environment refs; adds explicit Go import alias for environment.
schemas/constructs/v1beta1/component/component.yaml Normalizes model/capability refs and makes cross-package Go import aliases explicit.
schemas/constructs/v1beta1/academy/api.yml Replaces deep property refs with named schemas and pins invitation import alias.
schemas/constructs/v1alpha3/relationship/relationship.yaml Makes model/capability import aliases explicit for deterministic generation.
schemas/constructs/v1alpha1/core/api.yml Fixes semverString description text and length statement.
models/v1beta1/workspace/workspace.go Updates workspace model types to reuse v1alpha1 core primitives.
models/v1beta1/user/zz_generated.helpers.go Adds generated Scan/Value (Preference) + EventCategory (User).
models/v1beta1/user/user.go Aligns user model field types and nested config types with core primitives and named structs.
models/v1beta1/user/helpers.go Removes handwritten helpers now generated elsewhere.
models/v1beta1/team/zz_generated.helpers.go Adds generated EventCategory (Team).
models/v1beta1/team/team_helper.go Removes handwritten EventCategory now generated elsewhere.
models/v1beta1/team/team.go Aligns team model types with core primitives and updates pagination types.
models/v1beta1/subscription/zz_generated.helpers.go Adds generated EventCategory (Subscription).
models/v1beta1/subscription/subscription.go Consolidates payment processor enums and aligns IDs/timestamps with core primitives.
models/v1beta1/subscription/helpers.go Adds deprecated constant aliases to preserve old PaymentProcessor constant names.
models/v1beta1/schedule/zz_generated.helpers.go Adds generated EventCategory (Schedule).
models/v1beta1/schedule/schedule.go Adds generated schedule Go models from new construct schema.
models/v1beta1/role/zz_generated.helpers.go Adds generated EventCategory (Role).
models/v1beta1/role/role.go Adds generated role Go models from new construct schema.
models/v1beta1/role/helpers.go Adds Role.String() helper for debugging/logging.
models/v1beta1/plan/zz_generated.helpers.go Adds generated EventCategory (Plan).
models/v1beta1/plan/plan.go Aligns plan ID type with v1alpha1 core UUID.
models/v1beta1/plan/helpers.go Removes handwritten EventCategory now generated elsewhere.
models/v1beta1/pattern/pattern.go Updates pattern types/import aliases and refactors embedded structs to named types.
models/v1beta1/pattern/evaluation_models.go Renames core import alias to a stable name used in the file.
models/v1beta1/pattern/design_conversion.go Updates conversion logic to account for regenerated type shapes and pointer semantics.
models/v1beta1/organization/zz_generated.helpers.go Adds generated JSON Scan/Value (OrgMetadata) + EventCategory (Organization).
models/v1beta1/organization/organization.go Aligns org-related types with core primitives and replaces inline structs with named types.
models/v1beta1/organization/helpers.go Removes handwritten Scan/Value/EventCategory now generated elsewhere.
models/v1beta1/model/model.go Stabilizes cross-package imports, replaces inline model struct with named type, and aligns core types.
models/v1beta1/keychain/zz_generated.helpers.go Adds generator header comment for helper file.
models/v1beta1/keychain/keychain.go Aligns keychain types with core primitives and normalizes pagination types.
models/v1beta1/key/zz_generated.helpers.go Adds generator header comment for helper file.
models/v1beta1/key/key.go Aligns key types with core primitives and normalizes pagination types.
models/v1beta1/invitation/invitation.go Aligns invitation UUID types with core primitives.
models/v1beta1/feature/feature.go Aligns feature types with core primitives and stabilizes plan import alias.
models/v1beta1/event/event.go Aligns event bulk ID slices with core UUID type.
models/v1beta1/evaluation/evaluation.go Stabilizes pattern import alias and replaces map items with named schema types.
models/v1beta1/environment/zz_generated.helpers.go Adds generated EventCategory (Environment).
models/v1beta1/environment/environment_helper.go Removes handwritten EventCategory now generated elsewhere.
models/v1beta1/environment/environment.go Aligns environment types with core primitives and normalizes deleted_at handling.
models/v1beta1/credential/zz_generated.helpers.go Adds generated EventCategory (Credential).
models/v1beta1/credential/credential.go Adds generated credential Go models from new construct schema.
models/v1beta1/connection/zz_generated.helpers.go Adds generated EventCategory (Connection/MesheryInstance).
models/v1beta1/connection/connection_helper.go Fixes GORM Create usage and adds deprecated constant aliases for status values.
models/v1beta1/connection/connection.go Aligns core UUID/time types, stabilizes status constants, and reshapes ConnectionPage.
models/v1beta1/component/component_helper.go Updates Styles alias and adjusts SVG replacement logic for new styles type.
models/v1beta1/category/category.go Aligns category ID with core UUID.
models/v1beta1/badge/badge.go Aligns badge UUID/time types with core primitives.
models/v1beta1/academy/zz_generated.helpers.go Adds generated Scan/Value helpers for Map-backed structs.
models/v1beta1/academy/helpers.go Removes handwritten Scan/Value helpers now generated elsewhere.
models/v1beta1/academy/academy.go Stabilizes constants/import aliases and replaces deep refs with named types in Go.
models/v1alpha3/relationship/relationship_helper.go Adds deprecated type/constant aliases to preserve older generated names.
models/v1alpha3/relationship/relationship.go Aligns core UUID/semver types, introduces new typed enums, and reshapes patch/metadata types.
models/v1alpha1/core/core.go Normalizes constant naming, tightens Endpoint alias, and removes large unused union type.
models/v1alpha1/capability/capability.go Aligns capability fields with core primitives and schemaVersion/semver types.
build/openapi.config.yml Clears static import-mapping in favor of generator-derived per-package mappings.
build/lib/generated-go-helpers.js Adds generator for zz_generated.helpers.go (EventCategory + Scan/Value helpers).
build/generate-typescript.js Adjusts schema constant emission to keep buildable while validating shape via satisfies.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.


// Components A list of one or more component declarations.
Components []*component.ComponentDefinition `json:"components" yaml:"components"`
Components []componentv1beta1.ComponentDefinition `json:"components" yaml:"components"`

// Relationships List of relationships between components
Relationships []*relationship.RelationshipDefinition `json:"relationships" yaml:"relationships"`
Relationships []relationshipv1alpha3.RelationshipDefinition `json:"relationships" yaml:"relationships"`
Comment on lines +38 to +41
if component == nil {
continue
}

Comment on lines 89 to +97
compStyle := c.Styles
if compStyle != nil {
if compStyle.SvgColor != "" {
svgColor, err := utils.ReadSVGData(baseDir, compStyle.SvgColor)
if err == nil {
compStyle.SvgColor = svgColor
} else {
return err
}
}
Comment on lines +96 to 135
Connections []struct {
// Id A Universally Unique Identifier used to uniquely identify entities in Meshery. The UUID core definition is used across different schemas.
Id corev1alpha1.Uuid `json:"id" yaml:"id"`

// Name Connection Name
Name string `db:"name" json:"name" yaml:"name"`

// CredentialId A Universally Unique Identifier used to uniquely identify entities in Meshery. The UUID core definition is used across different schemas.
CredentialId *corev1alpha1.Uuid `json:"credential_id,omitempty" yaml:"credential_id,omitempty"`

// Type Connection Type (platform, telemetry, collaboration)
Type string `db:"type" json:"type" yaml:"type"`

// SubType Connection Subtype (cloud, identity, metrics, chat, git, orchestration)
SubType string `db:"sub_type" json:"sub_type" yaml:"sub_type"`

// Kind Connection Kind (meshery, kubernetes, prometheus, grafana, gke, aws, azure, slack, github)
Kind string `db:"kind" json:"kind" yaml:"kind"`

// Metadata Additional connection metadata
Metadata core.Map `db:"metadata" json:"metadata,omitempty" yaml:"metadata,omitempty"`

// Status Connection Status
Status ConnectionPageConnectionsStatus `db:"status" json:"status" yaml:"status"`

// UserId A Universally Unique Identifier used to uniquely identify entities in Meshery. The UUID core definition is used across different schemas.
UserId *corev1alpha1.Uuid `json:"user_id,omitempty" yaml:"user_id,omitempty"`
CreatedAt corev1alpha1.Time `json:"created_at,omitempty" yaml:"created_at,omitempty"`
UpdatedAt corev1alpha1.Time `json:"updated_at,omitempty" yaml:"updated_at,omitempty"`

// DeletedAt SQL null Timestamp to handle null values of time.
DeletedAt corev1alpha1.NullTime `json:"deleted_at,omitempty" yaml:"deleted_at,omitempty"`

// Environments Associated environments for this connection
Environments []environmentv1beta1.Environment `db:"-" gorm:"-" json:"environments,omitempty" yaml:"environments,omitempty"`

// SchemaVersion API version of the object, optionally prefixed with an API group (e.g. "group.example.io/v1beta1" or bare "v1beta1").
SchemaVersion corev1alpha1.VersionString `json:"schemaVersion" yaml:"schemaVersion"`
} `json:"connections" yaml:"connections"`

@miacycle
Copy link
Copy Markdown
Member

Addressed the latest generator feedback on PR #629 in bb77ef4.

Changes made:

  • updated build/generate-golang.js so schema-declared extra tags replace existing generated tags instead of being skipped when the tag key already exists
  • regenerated models/v1beta1/component/component.go so ComponentDefinition.ModelId now preserves gorm:"index:idx_component_definition_dbs_model_id,column:model_id" while restoring json:"-" and yaml:"-"

Validated locally against the PR 629 branch with:

  • NODE_PATH=/Users/l/code/schemas/node_modules SCHEMA_PACKAGE=component node build/generate-golang.js

This keeps the exact id -> ID normalization scoped to PR #637, while fixing the remaining tag-override bug on PR #629 itself.

@fitzergerald fitzergerald merged commit 13eed72 into master Mar 18, 2026
1 of 2 checks passed
@fitzergerald fitzergerald deleted the add-credential-role-schedule-models branch March 18, 2026 23:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/ci Continuous integration | Build and release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants